package com.ylb.mapper;

import com.ylb.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author: ylb
 * @create: 2021.3.22
 */
@Mapper
public interface UserMapper {

    @Insert("insert into user(username,password,age,phone,birthday) values (#{username},#{password},#{age},#{phone},#{birthday})")
    @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
    void addUser(User user);

    @Select("select * from user")
    List<User> findUsers();
}
